<?php
require("konf.php");
  if(isSet($_REQUEST["hobusenimi"])){
    $yhendus=new mysqli($masin, $kasutaja, $parool, $baas);
	$kask=$yhendus->prepare("INSERT INTO hobune(hobusenimi, vanus, omanik, latter_id) VALUES(?, ?, ?, ?)");
	$kask->bind_param("sssd", $_REQUEST["hobusenimi"], $_REQUEST["vanus"], $_REQUEST["omanik"], $_REQUEST["latter_id"]);
	$kask->execute();
	echo $yhendus->error;
	$yhendus->close();
	header("Location: admin.php");
	exit();
}

 require("konf.php");
$yhendus=new mysqli($masin, $kasutaja, $parool, $baas);
if(isSet($_REQUEST["kustutusid"])){
  $kask=$yhendus->prepare("DELETE FROM hobune WHERE id=?");
  $kask->bind_param("i", $_REQUEST["kustutusid"]);
  $kask->execute();
}
?>

<!DOCTYPE html>
<html>
  <head>
    <title>Administraatori leht</title>
	  <link href="admin.css" rel="stylesheet" type="text/css" media="screen" />
  </head>
  <body>
    <h1>Hobuste lisamine</h1>
	    <form action="?">
	      Hobuse nimi: <div id="tabel"><input type="text" name="hobusenimi" /></div><br />
	      Hobuse vanus: <div id="tabel"><input type="text" name="vanus" /></div><br />
	      Hobuse omanik: <div id="tabel"><input type="text" name="omanik" /></div><br />
		  Hobuse latteri number: <div id="tabel"><input type="text" name="latter_nr" /></div><br />
	      <input type="submit" value="sisesta" />
        </form>
	
	
	
	  
    
	
	
	
	<ul>
	  <li><a href="/~aleksaasaru/veebiprogrameerimine/algus/Nadal12/grupp/avaleht.php">Avalehele</a></li>
	</ul>
	
	
  </body>
</html> 